<template>
<ul class="mui-table-view">
				<li class="mui-table-view-cell mui-media" v-for='list in newsList' :key='list.id'>
					<router-link :to="'/home/newsInfo/'+list.id">
						<img class="mui-media-object mui-pull-left" :src="list.img_url">
						<div class="mui-media-body">
							<h2>{{list.title}}</h2>  
							<div class='mui-ellipsis'>
                                <span>发表时间：{{list.add_time | dataFormat}}</span>
                                <span>点击{{list.click}}次</span>
                            </div>
						</div>
					</router-link>
				</li>
			</ul>
</template>
<script>
import {Toast} from 'mint-ui';
    export default{
        data(){
            return {newsList:[]}
        },
        created(){
            this.getNewsList()
        },
        methods:{
            getNewsList(){
                this.$http.get('api/getnewslist').then((results)=>{
                    console.log(results.body)
                    if(results.body.status==1){
                        Toast('加载失败！稍后重试')
                    }else{
                        this.newsList=results.body.message;
                    }
                })
            }
        }
    }
</script>
<style scoped lang='scss'>
.mui-table-view-cell{
    .mui-media-body{ 
    h2{
        font-size:14px;
    }
    .mui-ellipsis{       
    display: flex;
    justify-content:space-between;
     color:#226aff;
     font-size:12px;
}
}
}
</style>

